{include file="header/index" /}
<meta charset="UTF-8">
	<style>
		.form-control {
			height: 33px;
		}
	</style>

	<body>
		<div class="container wrapper-content animated fadeInRight">
			<div class="row" style="padding: 0 -20px;">
				<div class="col-sm-12" style="padding: 0;">
					<div class="ibox float-e-margins">
						<div class="ibox-title">
							<h5>添加用户组</h5>
						</div>
						<div class="ibox-content">
							<form class="form-horizontal" name="userAdd" id="userAdd" method="post" action="">
								<input name="id" type="hidden" value="{$data.id}"/>
								<div class="form-group">
									<label class="col-sm-3 control-label">用户组名称：</label>
									<div class="input-group col-sm-4">
										<input id="title" type="text" class="form-control" name="title" value="{$data.title}">
									</div>
								</div>
								<div class="hr-line-dashed"></div>
								
								<div class="form-group">
									<label class="col-sm-3 control-label">状&nbsp;态：</label>
									<div class="col-sm-6">
										<div class="switchery-radio" style="padding-top: 8px;">
											<input type="checkbox" name="status" value="1" class="js-switch" {if condition="$data['status'] eq 1"}checked{/if}>
											默认开启
										</div>
									</div>
								</div>
								<div class="hr-line-dashed"></div>
								<div class="form-group">
									<div class="col-sm-4 col-sm-offset-3">
										<button class="btn btn-primary" type="button" onclick="add();"><i class="fa fa-save"></i> 保存</button>&nbsp;&nbsp;&nbsp;
										<a class="btn btn-danger" href="javascript:history.go(-1);"><i class="fa fa-close"></i> 返回</a>
									</div>
								</div>
							</form>
						</div>
					</div>

				</div>
			</div>
		</div>
	</body>
	
	
	<script>
		function add(){
			var title = $("#title").val();
			var status = $('input[name="status"]:checked').val();
			var id = $('input[name="id"]').val();
			if(title == ''){
				layer.msg('请填写用户组名称', {icon: 2,time: 2000});
			}
			
			$.post("{:url('Authgroup/edit')}",{title:title,status:status,id:id},function(returndata){
				if(returndata.code == '1'){
	        		 layer.msg(returndata.msg, {icon: 1,time: 2000},function(){window.location.href=returndata.data});
	        	 }else{
	        		 layer.msg(returndata.msg, {icon: 2,time: 2000}); 
	        	 }
			},'json')
			
		}
	
	</script>
	
	

</html>